package com.example.expandablelistview.actionbar;

import android.app.ActionBar;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.example.expandablelistview.R;

public class ActionBarOverlay extends Activity {
	private TextView titleTv;
	
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.actionbaroverlay);
		
		titleTv = (TextView) findViewById(R.id.title);
	}
	
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.actionbarmenu, menu);

		return true;
	}
	
	public void mOnClick(View v) {
		switch (v.getId()) {
		case R.id.btntoggle:
			ActionBar ab = getActionBar(); 
			if (ab.isShowing()) {
				ab.hide();
				titleTv.setText("오버레이 액션바");
				((Button)v).setText("Show Action Bar");
			} else {
				ab.show();
				titleTv.setText("");
				
				((Button)v).setText("Hide Action Bar");
			}
			break;
		}
	}
}